<template>
  <div class="box">
    <div class="searchheader van-hairline--bottom">
      <van-search
        v-model="value"
        show-action
        placeholder="请输入搜索关键词"
        @search="onSearch"
        autofocus
        shape="round"
      >
        <template #action>
          <van-button
            class="searchbtn"
            type="primary"
            round
            size="mini"
            color="linear-gradient(to right, #ff6034, #ee0a24)"
            >搜索</van-button
          >
        </template>
        <template #left>
          <van-icon name="arrow-left" size="26" @click="$router.back()" />
        </template>
      </van-search>

    </div>
    <main>
        <div class="hasthing" v-if="flag">

        </div>
        <div class="nothing" v-else>
            <h3>抱歉，暂未找到相关信息</h3>
        </div>

    </main>
  </div>
</template>

<script>
import { getSearchList } from "../api/search";
export default {
  data() {
    return {
      value: "",
      searchList: [],
      flag:true,
    };
  },
  created() {
    getSearchList({
      count: 1,
      limitNum: 12,
      keyword: this.$route.params.keyword,
    }).then((res) => {
      console.log(res);
      switch (res.data.code) {
        case "10002":
        this.flag=false
          break;
        case "200":
          this.value = this.$route.params.keyword;
          this.searchList = res.data.data;
          break;
        default:
          break;
      }
      
    });
  },
};
</script>

<style>
</style>